import { Column, Entity, PrimaryGeneratedColumn, OneToMany } from 'typeorm';


@Entity('message')
export class MessageEntity {
  @PrimaryGeneratedColumn({
    type: 'int',
    name: 'id',
    comment: '主键id',
  })
  id: number;

  @Column('varchar', {
    nullable: false,
    primary: true,
    length: 50,
    name: 'uuid',
    generated: 'uuid',
    comment: 'uuid',
  })
  uuid: string;

  @Column('varchar', {
    nullable: false,
    length: 100,
    name: 'origin',
    comment: '消息来源',
  })
  origin: string;

  @Column('varchar', {
    nullable: false,
    length: 100,
    name: 'title',
    comment: '标题',
  })
  title: string;

  @Column('varchar', {
    nullable: false,
    length: 100,
    name: 'subtitle',
    comment: '副标题',
  })
  subtitle: string;

  @Column('varchar', {
    nullable: false,
    name: 'content',
    comment: '消息内容',
  })
  content: string;

  @Column('timestamp', {
    nullable: false,
    default: () => 'CURRENT_TIMESTAMP',
    name: 'createdAt',
    comment: '创建时间',
  })
  createdAt: Date;

  @Column('timestamp', {
    nullable: false,
    default: () => 'CURRENT_TIMESTAMP',
    name: 'updatedAt',
    comment: '更新时间',
  })
  updatedAt: Date;
}
